package com.cdream.basic.algorithm.leetcode.dfs;

/**
 * @author cdream
 * @date 2022/2/25
 */
public class Question537 {
    public static void main(String[] args) {

    }
    public String complexNumberMultiply(String num1, String num2) {
        int n1,n2;
        String[] arr1,arr2;
        String fh1,fh2;

        arr1 = num1.split("\\+");



        arr2 = num2.split("\\+");

        String s1="";
        int x1 = Integer.parseInt(arr1[0]);
        int x2 = Integer.parseInt(arr2[0]);

        int i1 = Integer.parseInt(arr1[1].substring(0,arr1[1].indexOf("i")));
        int i2 = Integer.parseInt(arr2[1].substring(0,arr2[1].indexOf("i")));


        return ""+(x1 * x2 - i1 * i2) +"+" +(x1 * i2 + x2 * i1)+"i";


    }
}
